package com.example.administrator.exkotlin.view

import android.app.Activity
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.widget.LinearLayout
import com.example.administrator.exkotlin.R
import kotlinx.android.synthetic.main.title.view.*

/**
 * 自定义标题
 * */
class TitleView(context: Context?, attrs: AttributeSet?) : LinearLayout(context, attrs) {

    var titleEditListtner: TitleEditListtner? = null

    init {
        //动态加载
        LayoutInflater.from(context).inflate(R.layout.title, this)
        btn_back.setOnClickListener {
            val activity = context as Activity
            activity.finish()
        }
        btn_edit.setOnClickListener {
            Log.i("TitleView", "  titleEditListtner?.editCheckListtner()")
            titleEditListtner?.editCheckListtner()
        }
        ll_base.setOnClickListener { }
    }

    interface TitleEditListtner {
        fun editCheckListtner()
    }
}